package com.xiaobias.a05;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.context.support.GenericApplicationContext;

import java.io.IOException;

public class A05Application {
     private static final Logger logger = LoggerFactory.getLogger(A05Application.class);

    public static void main(String[] args) throws IOException {
        // GenericApplication 是一个干净的容器
        GenericApplicationContext context = new GenericApplicationContext();
        context.registerBean("config", Config.class);
//        // @ComponentScan @Bean @Import @ImportResource
//        context.registerBean(ConfigurationClassPostProcessor.class);
//        // @MapperScanner
//        context.registerBean(MapperScannerConfigurer.class, bd -> {
//            bd.getPropertyValues().add("basePackage", "com.xiaobias.a05.mapper");
//        });
//        context.registerBean(ComponentScanPostProcessor.class);
//        context.registerBean(AtBeanPostProcessor.class);
        context.registerBean(MapperPostProcessor.class);

        // 初始化容器
        context.refresh();

        for (String name : context.getBeanDefinitionNames()) {
            System.out.println(name);
        }

        // 销毁容器
        context.close();
    }
}
